\documentclass[a4paper,11pt]{article}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{xltxtra}
\usepackage{color}
\usepackage{xcolor}
% Wrap file configure
\usepackage{wrapfig}
\usepackage[section]{placeins}

\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit}

% Insert the Listing
\usepackage{listings}
\lstset{
  language=erlang,
  xrightmargin=0pt,
  basicstyle=\small\sffamily,
  numbers=left,
  numberstyle=\tiny,
  frame=single,
  columns=fullflexible,
  showstringspaces=false,
  commentstyle=\color{red},
  breaklines=true,
  framerule=0.7pt,
  frameround=tttt,
  rulecolor=\color{blue}
}
\lstset{escapeinside={(*@}{@*)}}

\usepackage{program}
\newtheorem{algorithm}{Algorithm}[section]

\newcommand{\rrcomment}[1]{
  \rcomment{\textcolor{red}{#1}}
}
% Set link in the document
\usepackage{hyperref}
\hypersetup{colorlinks,%
            citecolor=blue,%
            filecolor=black,%
            linkcolor=red,%
            urlcolor=blue,%
            pdfauthor={Pengcheng Wang},
            pdftitle={EE509 2010-2011 Assignment 01},
            pdfsubject={EE509},
            pdfkeywords={Simulator, Queue theory},
            pdftex
}

\usepackage{enumerate}
\usepackage{graphicx}

\usepackage{ifthen}
\usepackage{fancyhdr}

% define the author and title
\author{Wang Pengcheng(wpc0000@gmail.com)}
\title{EE509 Assignment 01}
\date{\today}

\input{src/defs}
\begin{document}
\pagenumbering{Roman}
\setcounter{page}{1}

\input{coversheet/coversheet}

\newpage
\pagenumbering{roman}
\tableofcontents
\newpage
\pagestyle{fancy}
\fancyhead{} % clear all header fields
\fancyhead[CO]{}
\fancyhead[RO]{\thepage}
\fancyfoot{} % clear all footer fields
\fancyfoot[LO]{}
\fancyfoot[RO]{}
\fancyfoot[CO]{}

\renewcommand{\subsectionmark}[1]{\markright{\thesubsection\ #1}}

\newcommand{\mymarks}{
  \ifthenelse{\equal{\leftmark}{\rightmark}}
    {\leftmark} % if equal
    {\rightmark}} % if not equal
\fancyhead[LO]{\slshape \mymarks}

\pagenumbering{arabic}
\setcounter{page}{1}

\input{src/r1}
\input{src/r2}
\input{src/r3}
\input{src/r4}
\input{src/r5}
\end{document}

